<template>
  <div class="header">
    <a @click="logout">退出登录</a>
  </div>
</template>

<script>
export default {
  methods: {
    logout() {
      // const _this = this;
      this.$axios
        .get("/api/v1/logout", {
          headers: {
            Authorization: localStorage.getItem("token")
          }
        })
        .then(res => {
          this.$store.commit("REMOVE_INFO");
          this.$message.success("退出登入！");
          this.$router.push("/login");
        });
    }
  }
};
</script>

<style scoped>
.header {
  float: right;
  margin-right: 32px;
}
</style>
